<template>
  <div>
    <a-card :bordered="false">
      <f-search-form @searchHandler="searchHandler">
        <f-search-form-item label="项目代码" name="projectCode"/>
        <f-search-form-item label="专业包代码" name="majorCode"/>
        <f-search-form-item label="工程包代码" name="packageNo" slot="advanced"/>
        <f-search-form-item label="填报月份" type="month" name="reportMonth" slot="advanced"/>
        <f-search-form-item ref="supplierInfo" label="分包商" type="select" name="supplierId" :params="detailsParams"
                            :data="api.report.getBusProjectAllSupplier" labelKey="supplierName" valueKey="supplierId"
                            :showSearch="true" slot="advanced"/>
      </f-search-form>
      <f-table ref="table" rowKey="materialPackage100Id" :columns="columns" :scroll="{ x: columns.length*150 }"
               :exportBtn="false" :multiple="false" :operator="operator" :params="queryParam" :api="api.report">
      </f-table>
      <report-form-modal ref="reportFormModal"></report-form-modal>
    </a-card>
  </div>
</template>
<script>
  import api from './js/apiReport'
  import reportFormModal from './report_form_modal.vue'

  export default {
    name: 'TableList',
    props: {
      detailsParams: {},
      bmpInfo:{}
    },
    components: {
      reportFormModal
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      operator.push({
        name: '填报',
        that: this,
        handler: function(table, that) {
          that.refs.reportFormModal.handleShow(that.bmpInfo)
        }
      })
      return {
        api: Object.assign(api, this.api),
        refs: this.$refs,
        //列表初始化查询参数
        queryParam: {},
        operator: operator,
        // 表头
        columns: [
          {
            title: '序号',
            width: 60,
            align: 'center',
            customRender: (text, record, index) => index + 1
          },
          {
            title: '项目代码',
            align: 'center',
            width: 120,
            dataIndex: 'projectCode',
            scopedSlots: { customRender: 'projectCode' }
          },
          {
            title: '项目名称',
            align: 'center',
            width: 120,
            dataIndex: 'projectName'
          },
          {
            title: '专业名称',
            width: 120,
            align: 'center',
            dataIndex: 'majorName'
          },
          {
            title: '专业代码',
            width: 120,
            align: 'center',
            dataIndex: 'majorCode'
          },
          {
            title: '工程包名称',
            width: 120,
            align: 'center',
            dataIndex: 'packageName'
          },
          {
            title: '工程包代码',
            width: 120,
            align: 'center',
            dataIndex: 'packageNo'
          },
          {
            title: '服务代码',
            width: 120,
            align: 'center',
            dataIndex: 'serviceCode'
          },
          {
            title: '服务WBS代码',
            width: 120,
            align: 'center',
            dataIndex: 'serviceWbsCode'
          },
          {
            title: '科目名称',
            width: 120,
            align: 'center',
            dataIndex: 'subjectName'
          },
          {
            title: '层级号',
            width: 120,
            align: 'center',
            dataIndex: 'levelNo'
          },
          {
            title: '分承包发包项目描述',
            width: 120,
            align: 'center',
            dataIndex: 'packageDesc'
          },
          {
            title: '对外合同清单描述',
            width: 150,
            align: 'center',
            dataIndex: 'contractDesc'
          },
          {
            title: '区域',
            width: 100,
            align: 'center',
            dataIndex: 'materialArea'
          },
          {
            title: '系统',
            width: 100,
            align: 'center',
            dataIndex: 'materialUse'
          },
          {
            title: '标前工程量',
            width: 100,
            align: 'center',
            dataIndex: 'beforeMarkQuantity'
          },
          {
            title: '合同清单工程量',
            width: 150,
            align: 'center',
            dataIndex: 'contractBillQuantity'
          },
          {
            title: '100预算成本工程量',
            width: 150,
            align: 'center',
            dataIndex: 'costQuantity100'
          },
          {
            title: '200预算成本工程量',
            width: 150,
            align: 'center',
            dataIndex: 'costQuantity200'
          },
          {
            title: '分包商',
            width: 100,
            align: 'center',
            dataIndex: 'supplierName'
          },
          {
            title: '合同数量',
            width: 100,
            align: 'center',
            dataIndex: 'supplierNum'
          },
          {
            title: '申报数量',
            align: 'center',
            width: 100,
            dataIndex: 'declareQuantity'
          },
          {
            title: '确认数量',
            align: 'center',
            width: 100,
            dataIndex: 'confirmQuantity'
          },
          {
            title: '填报月份',
            align: 'center',
            width: 100,
            dataIndex: 'reportMonth'
          },
          {
            title: '填报人',
            align: 'center',
            width: 100,
            dataIndex: 'userName'
          }
        ]
      }
    },
    created() {
      this.detailsParams['materialId'] = ''
      this.queryParam = this.detailsParams
    },
    methods: {}
  }
</script>
